package com.ljh.controller;


import com.ljh.pojo.Tag;
import com.ljh.service.ITagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.security.PermitAll;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lijiahao
 * @since 2021-09-24
 */
@RestController
@RequestMapping("/tag")
public class TagController {

    @Autowired
    private ITagService tagService;

    @GetMapping
    public List<Tag> listAll(){
        return tagService.list();
    }

    @GetMapping("/{id}")
    public Tag tag(@PathVariable("id") int id){
        return tagService.getById(id);
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable("id") int id){
        tagService.removeById(id);
        return "删除成功";
    }
}
